#!/bin/bash
# using the #! trick you can execute with whatever you like
# Example "generic" tag event script for tagEventor from autelic
# See http://www.autelic.org for more on autelic
# See http://code.google.com/p/tc-squared for more on tagEventor
# parameters passed are:
# $1 = UID (unique ID of the tag, as later we may use wildcard naming)
# $2 = Event Type (IN for new tag placed on reader, OUT for tag removed from reader)

# get the type of OS we are running on
OS=`uname`

# show a message in a dialog on the screen
if [[ $2 = "IN" ]]
then
   case $OS in
      Linux)
         export DISPLAY=:0.0
         /usr/bin/X11/xmessage -center -timeout 5 "Generic event script - Event $2, UID=$1"&
         exit 0
      ;;

      Darwin)
         /usr/local/bin/growlnotify -m "Tag with UID = $1, Event Type = IN"
      ;;

      *)
         echo Sorry, your OperatingSystem is not supported
         echo You will have to edit the "generic" script and add your own command
         echo Your Operating system was detected as being $OS
         echo Please contact tagEventor project at http://tageventor.googlecode.com to request support for your OS.
         exit -1
      ;;

esac
fi
